<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 1,1,2,3,5,8,13,21,34,55,89
      function Fib(num) {
        var n = num,
          a1 = 1,
          a2 = 1,
          a3;
        for (let i = 2; i < n; i++) {
          a3 = a1 + a2;
          a1 = a2;
          a2 = a3;
        }
        if (n == 1 || n == 2) {
          console.log(1);
        } else {
          console.log(a3);
        }
      }
      Fib(10);

      function Fib2(num) {
        var n = num;
        if (n == 1 || n == 2) {
          return 1;
        }
        for (let i = n; n > 0; n--) {}
      }
    </script>
  </body>
</html>
